﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/admin/Views/Shared/Create.Master"
    Inherits="System.Web.Mvc.ViewPage<Longtop.Web.SaleWeb.Admin.Achievements.CreateModel>" %>

<asp:Content ContentPlaceHolderID="Scripts" runat="server" ID="Content2">
    <link href="../../../../Scripts/jquery-autocomplete/jquery.autocomplete.css" rel="stylesheet"
        type="text/css" />

    <script src="../../../../Scripts/jquery-autocomplete/jquery.autocomplete.pack.js"
        type="text/javascript"></script>

    <script src="../../../../Scripts/jquery.maskMoney.0.2.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(function() {

            $('input:text[name$="UserName"]')
//            .result(function(e,row,formated){
//            })
            .autocomplete(<%=Model.Department.Sales.SelectMany(p => { return new[] {new KeyValuePair<string,string>(p.UserName,(p.NickName??p.UserName)+"("+p.Email+")") }; }).ToJson()%>
, {
                minChars: 0,
                max: 20,
                autoFill: false,
                mustMatch: true,
                matchContains: true,
                scrollHeight: 220
                ,
                formatItem: function(row, i, total) {
                    // don't show the current month in the list of values (for whatever reason)
                    return row.Value;
                }
      ,
		formatResult: function(row) {
			return row.Key;
		}

            });
             $('input.money').maskMoney({symbol:'￥',thousands:''});
             $('input.percent').maskMoney({symbol:'',thousands:''});
        });
    </script>

</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <tr>
        <%if (Model.User.Departments.Count > 1) { %>
        <td colspan="2">
            <div id="contool" class="con-tool">
                <div class="tool">
                    选部门</div>
                <%foreach (var item in Model.User.Departments) {
                %>
                <%=Html.ActionLink(item.Text, "create", new { id = item.LableId })%>
                <%} %>
            </div>
        </td>
        <%}
          else {%>
        <td>
        </td>
        <%} %>
        <td>
            <%=Html.ValidationSummary() %>
        </td>
    </tr>
    <tr>
        <td>
            部门
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Department.Text, new { Readonly="readonly"})%>
            <%=Html.HiddenFor(model=>model.Department.LableId)%>
            <%= Html.ValidationMessageFor(model => model.Department.Text)%>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.Sale.UserName) %>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.Sale.UserName)%>
            <a href="#" title="双击文本框选择人员">?</a>
            <%= Html.ValidationMessageFor(model => model.Model.Sale.UserName) %>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.ProductName) %>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.ProductName) %>
            <%= Html.ValidationMessageFor(model => model.Model.ProductName) %>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.Years)%>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.Years, new { maxlength=2, Class="years" })%>
            <%= Html.ValidationMessageFor(model => model.Model.Years) %>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.Amount) %>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.Amount,  new { Class="money"})%>
            <%= Html.ValidationMessageFor(model => model.Model.Amount)%>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.Reached) %>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.Reached, new { Class = "money" })%>
            <%= Html.ValidationMessageFor(model => model.Model.Reached)%>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.ReachedCount)%>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.ReachedCount, new { Class = "money" })%>
            <%= Html.ValidationMessageFor(model => model.Model.ReachedCount)%>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.NoReached)%>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.NoReached, new { Class = "money" })%>
            <%= Html.ValidationMessageFor(model => model.Model.NoReached)%>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.Price)%>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.Price, new { Class = "money" })%>
            <%= Html.ValidationMessageFor(model => model.Model.Price)%>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.Discount) %>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.Discount, new { Class = "percent" })%>
            <%= Html.ValidationMessageFor(model => model.Model.Discount) %>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.SaleDiscount) %>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.SaleDiscount, new { Class = "percent" })%>
            <%= Html.ValidationMessageFor(model => model.Model.SaleDiscount) %>
        </td>
    </tr>
    <tr>
        <td>
            <%= Html.LabelFor(model => model.Model.SaleAchievement) %>
        </td>
        <td>
            <%= Html.TextBoxFor(model => model.Model.SaleAchievement, new { Class = "money" })%>
            <%= Html.ValidationMessageFor(model => model.Model.SaleAchievement) %>
        </td>
    </tr>
</asp:Content>
